package check;

public class AppClass {

	private AppClassContext _fsm;
	private boolean _is_acceptable;

	public AppClass() {
		_fsm = new AppClassContext(this);
		_is_acceptable = false;
	}

	public boolean CheckString(String string) {
		int i, Length;
		_fsm.enterStartState();

		for (i = 0, Length = string.length(); i < Length; ++i) {
			switch (string.charAt(i)) {
			case '0':
				_fsm.Zero();
				break;
			case '1':
				_fsm.One();
				break;
			default:
				_fsm.Unknown();
				break;
			}
		}
		_fsm.EOS();
		return (_is_acceptable);
	}

	public void Acceptable() {
		_is_acceptable = true;
	}

	public void Unacceptable() {
		_is_acceptable = false;
	}
}
